
import 'package:web_dev_proxy_shelf/web_dev_proxy.dart';

class LocalProxyConfig {
  static String targetUrl = 'http://117.18.98.247:8616';
  static const String localHost = 'localhost';
  static const int localPort = 8616;

  static const String localProxyUrlWeb = "http://$localHost:$localPort";
}

void main() async {
  await startLocalProxyServerForWebDebug(LocalProxyConfig.localHost, LocalProxyConfig.localPort, LocalProxyConfig.targetUrl, true);

  // var interfaces = await NetworkInterface.list();
  // var interAddress = interfaces[0].addresses.single;
  // var ipLocal = interAddress.address;
  //
  // var server = await shelf_io.serve(
  //   // 目标地址
  //   proxyHandler("http://117.18.98.247:8616", proxyName: "*"),
  //   ipLocal,
  //   8616,
  // );
  // // 跨域限制
  // server.defaultResponseHeaders.add('Access-Control-Allow-Origin', '*');
  // server.defaultResponseHeaders.add('Access-Control-Allow-Credentials', true);
  //
  // print('启动成功， Proxying at http://${server.address.host}:${server.port}');
}
